var Metadata = {
    GetData: function () { 
        // returns the current start row, numrows, and current page
        // as displayed in the "metadata" div (elements/table/metadata)

        var div = g( 'metadata' );
        var table = g( 'tabledata' );

        if ( !div ) { 
            // no info on metadata
            // there is only one row, or no rows
            if ( table.getElementsByTagName( 'tr' ).length == 2 ) { // only the title and insert row, no data rows
                return [ 0, 0, 0 ];
            }
            else {
                return [ 1, 1, 0 ]; // start row=1, total rows=1, first page (0) displayed now
            }
        }
        
        var spans = div.getElementsByTagName( 'span' );

        var start_row = parseInt( spans[ 0 ].innerHTML );
        var end_row = parseInt( spans[ 1 ].innerHTML );
        var numrows;
        var curpage;
        if ( spans.length == 3 ) { // total_rows span is omitted
            numrows = end_row;
            curpage = spans[ 2 ].innerHTML;
        }
        else {
            numrows = parseInt( spans[ 2 ].innerHTML );
            curpage = parseInt( spans[ 3 ].innerHTML );
        }

        return [ start_row, numrows, curpage ];
    }
}
